package thread2;

import javax.swing.*;

//import JoptionPaneExample.ButtonListener1;

import java.awt.*;
import java.awt.event.*;
class Calculator extends JFrame{
	private Container cp;
	public Calculator(){
		setTitle("模拟银行管理系统");
		setSize(1280,768);
		cp=getContentPane();
		cp.setLayout(new BorderLayout());
		JPanel jp1=new JPanel();
		JPanel jp2=new JPanel();
		Font ft1=new Font("Times",Font.PLAIN,20);
		Font ft2=new Font("宋体",Font.PLAIN,14);
		jp1.setLayout(new GridLayout(6,1));
		JButton      b1=new JButton("创建新帐户 ");b1.setFont(ft1);
		JButton      b2=new JButton("存款  ");b2.setFont(ft1);
		JButton      b3=new JButton("取款   ");b3.setFont(ft1);
		JButton      b4=new JButton("消费  ");b3.setFont(ft1);
		JButton      b5=new JButton(" 删除帐户   ");b4.setFont(ft1);
		JButton      b6=new JButton(" 帐户余额   ");b5.setFont(ft1);
	
		jp1.add(b1);
		jp1.add(b2);
		jp1.add(b3);
		jp1.add(b4);
		jp1.add(b5);
		jp1.add(b6);		
		cp.add(jp1,BorderLayout.WEST);
		jp2.setLayout(new GridLayout(5,1));
		JButton  b7=new JButton("个人帐户明细");b7.setFont(ft1);
		JButton  b8=new JButton("帐户明细");b8.setFont(ft1);
		JButton  b9=new JButton("透支次数");b9.setFont(ft1);
		JButton  b10=new JButton("透支帐户");b10.setFont(ft1);
		JButton  b11=new JButton("退出    ");b11.setFont(ft1);
		jp2.add(b7);
		jp2.add(b8);
		jp2.add(b9);
		jp2.add(b10);
		jp2.add(b11);
			cp.add(jp2,BorderLayout.EAST);
			
			     b1.addActionListener(new ButtonListener1());
		  	    b2.addActionListener(new ButtonListener2());
		  	    b3.addActionListener(new ButtonListener3());
		  	    b4.addActionListener(new ButtonListener4());
		  	    b5.addActionListener(new ButtonListener5());
		  	    b6.addActionListener(new ButtonListener6());
		  	    b7.addActionListener(new ButtonListener7());
		  	    b8.addActionListener(new ButtonListener8());
		  	    b9.addActionListener(new ButtonListener9());
		  	    b10.addActionListener(new ButtonListener10());
		   	    b11.addActionListener(new ButtonListener11());							
			    addWindowListener(new WindowDestroy());
			}
	
	class ButtonListener1 implements ActionListener{
		public void actionPerformed(ActionEvent e){
			String n="";
			n=JOptionPane.showInputDialog("创建新帐户"/*,注册 ,JOptionPane.INFORMATION_MESSAGE*/);
			//System.out.println(n);
			String idNum="";
			idNum=JOptionPane.showInputDialog("设置密码"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			//System.out.println(idNum);
			String s;
			s=JOptionPane.showInputDialog("再次输入密码"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(s);
			JOptionPane.showMessageDialog(null, "创建一个新帐户成功", "注册成功",JOptionPane.PLAIN_MESSAGE);
			
		   }
		
		
		}
	
	class ButtonListener2 implements ActionListener{
		public void actionPerformed(ActionEvent e){
			String str="";
			str=JOptionPane.showInputDialog("输入账号"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(str);
			
			String st="";
			st=JOptionPane.showInputDialog("输入密码"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(st);
			JOptionPane.showMessageDialog(null, "将钞票叠整齐后放入存钞口", "存款",JOptionPane.PLAIN_MESSAGE);
			
		   }
		}
		
	class ButtonListener3 implements ActionListener{
		public void actionPerformed(ActionEvent e){
			String str="";
			str=JOptionPane.showInputDialog("输入账号"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(str);
			
			String st="";
			st=JOptionPane.showInputDialog("输入密码"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(st);
			st=JOptionPane.showInputDialog("输入取款金额"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(st);
					   }
		}
	class ButtonListener4 implements ActionListener{
		public void actionPerformed(ActionEvent e){
			String str="";
			str=JOptionPane.showInputDialog("输入账号"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(str);
			
			String st="";
			st=JOptionPane.showInputDialog("输入密码"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(st);
			st=JOptionPane.showInputDialog("输入消费金额"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(st);
			
			
			
		   }
		}
	class ButtonListener5 implements ActionListener{
		public void actionPerformed(ActionEvent e){
			String str="";
			str=JOptionPane.showInputDialog("输入账号"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(str);
			
			String st="";
			st=JOptionPane.showInputDialog("输入密码"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(st);
			
			int n = JOptionPane.showConfirmDialog(null, "删除帐户", "",JOptionPane.YES_NO_OPTION);//i=0/1  
			JOptionPane.showMessageDialog(null, "帐户删除成功", "删除帐户",JOptionPane.PLAIN_MESSAGE);
		   }
		}
	
	class ButtonListener6 implements ActionListener{
		public void actionPerformed(ActionEvent e){
			String str="";
			str=JOptionPane.showInputDialog("输入要查询的账号"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(str);
			
			String st="";
			st=JOptionPane.showInputDialog("输入密码"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(st);
		   }
		}
	class ButtonListener7 implements ActionListener{
		public void actionPerformed(ActionEvent e){
			String str="";
			str=JOptionPane.showInputDialog("输入要查询的账号"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(str);
			
			String st="";
			st=JOptionPane.showInputDialog("输入密码"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(st);
			JOptionPane.showMessageDialog(null, "查询个人明细", "查询帐户",JOptionPane.PLAIN_MESSAGE);

		   }
		}
	class ButtonListener8 implements ActionListener{
		public void actionPerformed(ActionEvent e){
			String str="";
			str=JOptionPane.showInputDialog("输入要查询的账号"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(str);
			
			String st="";
			st=JOptionPane.showInputDialog("输入密码"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(st);
			JOptionPane.showMessageDialog(null, "查询帐户明细", "查询帐户",JOptionPane.PLAIN_MESSAGE);

			
		   }
		}
	class ButtonListener9 implements ActionListener{
		public void actionPerformed(ActionEvent e){
			String str="";
			str=JOptionPane.showInputDialog("输入要查询的账号"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(str);
			
			String st="";
			st=JOptionPane.showInputDialog("输入密码"/*,"INFORMATION MESSAGE",JOptionPane.INFORMATION_MESSAGE*/);
			System.out.println(st);
			JOptionPane.showMessageDialog(null, "查询透支次数", "查询帐户",JOptionPane.PLAIN_MESSAGE);

		   }
		}
	class ButtonListener10 implements ActionListener{
		public void actionPerformed(ActionEvent e){
			JOptionPane.showMessageDialog(null, "查询透支帐户", "查询帐户",JOptionPane.PLAIN_MESSAGE);

		   }
		}
	class ButtonListener11 implements ActionListener{
		public void actionPerformed(ActionEvent e){
			JOptionPane.showMessageDialog(null, "退出系统", "",JOptionPane.PLAIN_MESSAGE);  
		   }
		}
	
	
}
class WindowDestroy extends WindowAdapter{
	public void windowClosing(WindowEvent e){
		System.exit(0);
	}
}
public class BankSystem{
	public static void main(String args[]) {
		Calculator win=new Calculator();
		win.setVisible(true);
	}
}